<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function compress_html_output() {
	$CI =& get_instance();
	$buffer = $CI->output->get_output();

	$search = array(
    '/\>[^\S ]+/s',    //strip whitespaces after tags, except space
    '/[^\S ]+\</s',    //strip whitespaces before tags, except space
    '/(\s)+/s',    // shorten multiple whitespace sequences
	'/\t/s'
	);
	$replace = array(
    '>',
    '<',
    '\\1',
	'\\1'
    );
    $buffer = preg_replace($search, $replace, $buffer);

    $CI->output->set_output($buffer);
    $CI->output->_display();
}